 <%@page import="com.naszetatry.constans.Message"%>
<%@page import="com.naszetatry.controller.LoginController"%>
<%@page import="com.naszetatry.controller.UserController"%>
<%@page import="com.naszetatry.login.LValidation"%>

 <div id="loginPanel">
 	<% if(!UserController.isLogged(session)) { 
 	   LValidation lValidation = LoginController.getValidation(request);
 	%>
	<form action="login">
		
		<div class = "validation">
			<%
			if(!(lValidation.isLoginValid && lValidation.isPasswordValid))
				out.println(Message.LOGIN_FAILED);
			if(!lValidation.isActivated)
				out.println(Message.INACTIVE);
			%>
		</div>
		<table>
			<tr>
				<td>
       				login:
       			</td>
       			<td>
       				<input type="text" name="login"/>
       			</td>
       		</tr>
       		<tr>
       			<td>		
       				haslo:
       			</td>
       			<td>
       				 <input type="password" name="password"/>
       			</td>
       		</tr>
       	</table>		 
       	<input type="submit" value="zaloguj"/>
       				
       
    </form>
    <!-- first visit -->
    <a href = "registration?do=1">zarejestruj sie</a>
    <br><a href = "passwordReminder?do=1">zapomnialem hasla</a>
    <% }
 	   else { 
 	   out.println("uzytkownik: "+ UserController.getUser(session).getLogin());	   
 	%>
 	<br><a href = "login?do=logout">wyloguj sie</a>
	<% }
 	%>
</div>